import React from 'react';
import { Pagination } from 'antd';
import Pts from 'prop-types';
const Mypagniation = (props) => {
  // 切换页数和每页多少条数据的时候触发
  const onChange = (page, pageSize) => {
    // console.log(page, pageSize);
    props.setPage(page)
    props.getlistHandler({ keyword: props.keyword, page })
  }
  return (
    <div style={{marginTop: '20px', textAlign: 'center'}}>
      <Pagination defaultCurrent={props.page} current={props.page} total={props.total} onChange={(page, pageSize) => onChange(page, pageSize)} />
    </div>
  );
}

Mypagniation.defaultProps = {
  page: 1,
}

Mypagniation.propTypes = {
  page: Pts.number.isRequired,
  total: Pts.number.isRequired,
  keyword: Pts.string
}

export default Mypagniation;
